<template>
    <div>
        <el-table :data="posList" stripe style="width: 100%" highlight-current-row border>
            <el-table-column prop="name" label="店名" align="center"></el-table-column>
            <el-table-column prop="licenseNumber" label="营业执照号码" align="center"></el-table-column>
            <el-table-column label="营业执照图片" align="center">
                <template slot-scope="scope">
                    <el-image
                        style="width: 50px; height: 50px"
                        :src="scope.row.licenseImg"
                        :preview-src-list="[scope.row.licenseImg]"
                    ></el-image>
                </template>
            </el-table-column>
            <el-table-column prop="address" label="地址" align="center"></el-table-column>
            <el-table-column prop="x" label="经度" align="center"></el-table-column>
            <el-table-column prop="y" label="纬度" align="center"></el-table-column>
            <el-table-column prop="city" label="所在城市" align="center"></el-table-column>
            <el-table-column prop="corporation" label="法人" align="center"></el-table-column>
            <el-table-column prop="phone" label="联系电话" align="center"></el-table-column>
            <el-table-column label="头像" align="center">
                <template slot-scope="scope">
                    <el-image
                        style="width: 50px; height: 50px"
                        :src="scope.row.headImg"
                        :preview-src-list="[scope.row.headImg]"
                    ></el-image>
                </template>
            </el-table-column>
            <el-table-column prop="feature" label="特色" align="center"></el-table-column>
            <el-table-column prop="vip" label="vip等级" align="center"></el-table-column>
            <el-table-column prop="commission" label="佣金比例" align="center"></el-table-column>
            <el-table-column label="店员属性" align="center">
                <template slot-scope="scope">
                    <el-popover placement="right" width="400" trigger="click">
                        <el-button slot="reference" type="primary">查看店员</el-button>
                        <el-table :data="scope.row.clerks">
                            <el-table-column property="name" label="姓名"></el-table-column>
                            <el-table-column property="tel" label="电话"></el-table-column>
                            <el-table-column property="age" label="年龄"></el-table-column>
                        </el-table>
                    </el-popover>
                </template>
            </el-table-column>
            <el-table-column prop="clerks" label="审核状态" align="center">
                <template slot-scope="scope">
                    <el-tag v-if="scope.row.state == 2" effect="plain">不通过</el-tag>
                </template>
            </el-table-column>
            <el-table-column label="操作" align="center">
                <template slot-scope="scope">
                    <el-row>
                        <el-link type="warning" @click="handlePass(scope.row._id)">
                            通过
                            <i class="el-icon-view el-icon--right"></i>
                        </el-link>
                    </el-row>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
import { getwaitPos, changeState } from '@/api/pos.js';
import { log } from 'util';
export default {
    data() {
        return {
            posList: []
        };
    },
    created() {
        this.getDate();
    },
    methods: {
        getDate() {
            getwaitPos({state:"2"}).then(res => {
                this.posList = res;
            });
        },
        handlePass(_id) {
            let params = { _id, state: '1' };
            changeState(params);
            this.getDate();
        },
    }
};
</script>

<style>
</style>